package com.yanqu.road.server.cmd.activity.signindraw;

import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.SignInDrawProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.signindraw.CrossSignInDrawActivityMgr;
import com.yanqu.road.server.manager.activity.signindraw.SignInDrawActivity;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_SIGN_IN_DRAW_DRAW, desc = "抽奖")
public class CrossSignInDrawGoCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

        SignInDrawProto.CrossSignInDrawGoReqMsg reqMsg = SignInDrawProto.CrossSignInDrawGoReqMsg.parseFrom(packet.getBytes());
        int activityId = reqMsg.getActivityId();
        SignInDrawActivity activity = CrossSignInDrawActivityMgr.getActivity(activityId);
        if(activity != null){
            activity.draw(serverId, packet.getPlayerId(), PlayerBasePb.parseToUserBaseInfo(reqMsg.getBaseInfo()), reqMsg.getActiveDay(), reqMsg.getUid());
        }
    }

    @Override
    public void sendData() {

    }
}
